Page({
  data: {
    // 折叠面板状态
    collapseStatus: [false, false, false],
    // 指标说明数据
    indexList: [
      {
        name: "藻细胞密度",
        unit: "个/L",
        description: "反映水体中藻类繁殖状况的核心指标"
      },
      {
        name: "水温",
        unit: "℃",
        description: "影响藻类生长速度的关键环境因子"
      },
      {
        name: "pH值",
        unit: "",
        description: "水体酸碱度，影响藻类群落结构"
      },
      {
        name: "溶解氧",
        unit: "mg/L",
        description: "反映水体富营养化程度的重要指标"
      },
      {
        name: "总磷",
        unit: "mg/L",
        description: "藻类生长的主要营养物质之一"
      },
      {
        name: "总氮",
        unit: "mg/L",
        description: "影响藻类繁殖的关键营养元素"
      }
    ]
  },

  onLoad() {
    // 页面加载时的初始化操作
  },

  // 返回按钮点击事件
  onClickLeft() {
    wx.navigateBack({
      delta: 1
    });
  },

  // 切换折叠面板状态
  toggleCollapse(e) {
    const index = e.currentTarget.dataset.index;
    const newStatus = [...this.data.collapseStatus];
    newStatus[index] = !newStatus[index];
    this.setData({
      collapseStatus: newStatus
    });
  },

  // 导航到实时监测页面
  navToMonitor() {
    wx.navigateTo({
      url: '/pages/monitor/index'
    });
  },

  // 导航到预测页面
  navToPrediction() {
    wx.navigateTo({
      url: '/pages/prediction/index'
    });
  },

  // 导航到历史数据页面
  navToHistory() {
    wx.navigateTo({
      url: '/pages/prediction/index'
    });
  },

  // 导航到预警页面
  navToAlert() {
    wx.navigateTo({
      url: '/pages/alert/index'
    });
  }
});
    